<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:a="http://richfaces.org/a4j"
      xmlns:r="http://richfaces.org/rich"
      xmlns:m="http://www.caradvert.com/main">

    <ui:composition>

        <c:set var="isFirstPage" value="#{pageAwareBean.pageNumber le 1}"/>
        <c:set var="isLastPage" value="#{pageAwareBean.pageNumber ge pageAwareBean.pageCount}"/>
        <c:set var="pageNumber" value="#{pageAwareBean.pageNumber}"/>
        <c:set var="disabledStyle" value="color:grey;"/>

        <table id="advertsNavigation">
            <tr>
                <td class="rj" style="width:60px;">
                    <h:outputLink disabled="#{isFirstPage}" style="#{isFirstPage ? disabledStyle : ''}"
                                  value="#{ctxPath}#{parentPage}#{not empty criteria ? '?' : ''}#{criteria}">
                        #{labels['FIRST']}
                    </h:outputLink>
                </td>
                <td class="rj" style="width:60px;">
                    <h:outputLink disabled="#{isFirstPage}" style="#{isFirstPage ? disabledStyle : ''}"
                                  value="#{ctxPath}#{parentPage}?page=#{pageNumber - 1}#{not empty criteria ? '&#38;' : ''}#{criteria}">
                        &lt;#{labels['BACK']}
                    </h:outputLink>
                </td>
                <td class="cj" style="width:40px;font-weight:bold;">
                    #{pageNumber}
                </td>
                <td class="lj" style="width:60px;">
                    <h:outputLink disabled="#{isLastPage}" style="#{isLastPage ? disabledStyle : ''}"
                                  value="#{ctxPath}#{parentPage}?page=#{pageNumber + 1}#{not empty criteria ? '&#38;' : ''}#{criteria}">
                        #{labels['NEXT']}&gt;
                    </h:outputLink>
                </td>
                <td class="lj" style="width:60px;">
                    <h:outputLink disabled="#{isLastPage}" style="#{isLastPage ? disabledStyle : ''}"
                                  value="#{ctxPath}#{parentPage}?page=last#{not empty criteria ? '&#38;' : ''}#{criteria}">
                        #{labels['LAST']}
                    </h:outputLink>
                </td>
            </tr>
        </table>
        
    </ui:composition>
</html>